package com.ruoyi.erp.message;

import com.ruoyi.common.utils.JDBCUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.SQLException;

public class Procedure {
    private Logger logger = LoggerFactory.getLogger(Procedure.class);

    private Connection conn;
    private CallableStatement call;

    //退回重填消息通知
    public boolean Submit_Send_Message(String Submit_Person_Id, String User_Person_Id) {
        String sql = "{call APPS.cux_common_pkg.send_message(?,?,?,?)}";
        //通知标题
        String Title = "您的员工信息采集被退回，请检查！";

        Clob clob_par = null;

        boolean flag = true;
        try {
            conn = JDBCUtil.getConnection();
            call = conn.prepareCall(sql);
            call.setInt(1, Integer.parseInt(Submit_Person_Id));
            call.setInt(2, Integer.parseInt(User_Person_Id));
            call.setString(3, Title);
            call.setClob(4, clob_par);
            call.execute();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            e.getMessage();
        } finally {
            try {
                call.close();
                conn.close();
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                e.getMessage();
                System.out.println(e.getMessage());
            }
        }
        return flag;
    }
}